package Circle::Chain;

use 5.006;
use strict;
use warnings;
use Carp;
use Circle::Wallet;

=head1 NAME

Circle::Chain - The great new Circle::Chain!

=head1 VERSION

Version 0.01

=cut

our $VERSION = '0.01';


=head1 SYNOPSIS

Quick summary of what the module does.

Perhaps a little code snippet.

    use Circle::Chain;

    my $chain = Circle::Chain->new();
    ...

=head1 EXPORT

A list of functions that can be exported.  You can delete this section
if you don't export anything, such as for a purely object-oriented module.

=head1 SUBROUTINES/METHODS

=head2 new

=cut

sub new {
    my $class = shift;
    return $class if ref $class;

    my $self = { @_ };
    bless $self, $class;
    $self->initialize();
    return $self;
}

=head2 initialize

init the chain object.

init fields:
1. wallets
2. wallet_index

=cut

sub initialize {
    my ($self) = @_;
    $self->load_wallets();
    if (@{$self->{wallets}} == 0) {
        my $wallet = Circle::Wallet->new();
        push @{$self->{wallets}}, $wallet;
        $self->{wallet_index} = 0;
    }
}


=head2 load_wallets

load wallets from the wallet data file.

=cut

sub load_wallets {
    my ($self) = @_;
    if (not defined $self->{wallets}) {
        $self->{wallets} = [];
    }
}

=head1 AUTHOR

charles li, C<< <lidh04 at gmail.com> >>

=head1 BUGS

Please report any bugs or feature requests to C<bug-circle-chain at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Circle-Chain>.  I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.




=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Circle::Chain


You can also look for information at:

=over 4

=item * RT: CPAN's request tracker (report bugs here)

L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Circle-Chain>

=item * CPAN Ratings

L<https://cpanratings.perl.org/d/Circle-Chain>

=item * Search CPAN

L<https://metacpan.org/release/Circle-Chain>

=back


=head1 ACKNOWLEDGEMENTS


=head1 LICENSE AND COPYRIGHT

This software is Copyright (c) 2024 by charles li.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)


=cut

1; # End of Circle::Chain
